//===================================================================================================\\
//===================================================================================================\\
//===	  ===================	  ===				  ===				  ===\\
//===	  ===================	  ===				  ===				  ===\\
//===	  ===================	  ===========================	  ===	  ===========================\\
//===	  ===================	  ===========================  	  ===	  ===========================\\
//===	  ===================	  ===========================	  ===	  ===========================\\
//===	  ===================	  ===========================	  ===		  ===================\\
//===	  ===================	  ===========================	  ===		  ===================\\
//===	  ===================	  ====	   ==================	  ===	  ===========================\\
//===	  ===================	  ====	    =================	  ===	  ===========================\\
//===				  =====				  ===				  ===\\
//===				  =========			  ===				  ===\\
//===================================================================================================\\
//===================================================================================================\\


game_manager
{
	spawn
	{
		// de ronde missie tijd
		wm_set_round_timelimit 15		// 30 minuten

		// spawntijden:
		wm_axis_respawntime 10
		wm_allied_respawntime 15

		// charge times:
		// Axis
		setchargetimefactor 0 soldier	1	// 1=100%   0.25=25%   etc.
		setchargetimefactor 0 medic	1
		setchargetimefactor 0 engineer	1
		setchargetimefactor 0 fieldops	1
		setchargetimefactor 0 covertops	1
		// Allies
		setchargetimefactor 1 soldier	1
		setchargetimefactor 1 medic	1
		setchargetimefactor 1 engineer	1
		setchargetimefactor 1 fieldops	1
		setchargetimefactor 1 covertops	1


		// Stopwatch mode: Het verdedigende team
		// (0=Axis, 1=Allies)
		wm_set_defending_team 1			// Allies verdedigen

		// De winnaar, als de rondetijd op is, en een evt. objective niet is gehaald:
		// (0=Axis, 1=Allies)
		wm_setwinner 0				// Allies winnen als de Axis niet het objective halen


		wm_number_of_objectives 6		// er zijn 6 objectives

		//wm_objective_status <objective> <team (0=Axis, 1=Allies)> <status (0=neutral 1=complete 2=failed)>				
		wm_objective_status 1 0 0		//Tank escorting
		wm_objective_status 1 1 0
		wm_objective_status 2 0 0		//Opening Gate
		wm_objective_status 2 1 0
		wm_objective_status 3 0 0		//Building bridge
		wm_objective_status 3 1 0
		wm_objective_status 4 0 0		//Get the flag
		wm_objective_status 4 1 0
		wm_objective_status 5 0 0		//Escort the truck
		wm_objective_status 5 1 0		
		wm_objective_status 6 0 0		//CP
		wm_objective_status 6 1 0



		wm_set_main_objective 1 0
		wm_set_main_objective 1 1


		// missie objectives instellen:
		wait 100 // wacht 0.1sec


		// spawnpoints
		setautospawn "House" 0		// spawnpoint voor axis
		setautospawn "Barrels" 1	// spawnpoint voor allies

		setstate bunker_gate_puin invisible
		setstate poort_hurt invisible
		setstate gate_hurt invisible
		setstate gate_door_dmg invisible
		setstate gang_muur_hurt invisible
		setstate riool_muur_hurt invisible
		setstate riool_muur_dmg invisible
		setstate riool_draden invisible
		setstate riool_wiel invisible
		setstate vulkaan_kapot invisible
		setstate riool_gate_rubble invisible
		setstate tank_break_wall_broken invisible
		setstate allied_door invisible


		setstate light_red invisible
		setstate light_blue invisible

		setstate axisspawns_dozen invisible
		setstate axisspawns_AxisVulcano invisible
		setstate axisspawns_tunnel invisible

		wait 1500

		construct bridge
		trigger de_deur open
		setstate hurtvulcano invisible
		setstate from_here_allies invisible
		setstate to_here_allies invisible
		trigger gate hide
		trigger bunker_gate_puin show
		trigger gang_muur hide
		trigger riool_muur_hurt hide
		setstate vulkaan_clip invisible
		trigger poort hide

	}

	// de rondetijd is verstreken (Axis objective is niet gehaald)
	trigger timelimit_hit
	{
		wm_announce "Time's up.. The Axis have survived the Allies."
		wm_endround
	}
}

from_here_allies0
	{
	spawn
	{
		wait 1000
		setstate from_here_allies0 invisible
		remove
	}
}

to_here_allies0
{
	spawn
	{
		wait 1000
		setstate to_here_allies0 invisible
		remove
	}
}

from_here_allies1
	{
	spawn
	{
		wait 1000
		setstate from_here_allies1 invisible
		remove
	}
}

to_here_allies1
{
	spawn
	{
		wait 1000
		setstate to_here_allies1 invisible
		remove
	}
}

from_here_allies2
	{
	spawn
	{
		wait 1000
		setstate from_here_allies2 invisible
		remove
	}
}

to_here_allies2
{
	spawn
	{
		wait 1000
		setstate to_here_allies2 invisible
		remove
	}
}

from_here_allies3
	{
	spawn
	{
		wait 1000
		setstate from_here_allies3 invisible
		remove
	}
}

to_here_allies3
{
	spawn
	{
		wait 1000
		setstate to_here_allies3 invisible
		remove
	}
}

alliesspawns_vulkaan
{
	spawn
	{
		wait 1000
		setstate alliesspawns_vulkaan invisible
		setstate alliesspawn_vulkaan invisible
		remove
	}
}

alliesspawns_tunnel
{
	spawn
	{
		wait 1000
		setstate alliesspawns_tunnel invisible
		setstate alliesspawn_tunnel invisible
		remove
	}
}

spawns_flag
{
	spawn
	{
		wait 1000
		setstate spawns_flag invisible
		setstate spawn_flag invisible
		remove
	}
}

alliesspawns_laatste
{
	spawn
	{
		wait 1000
		setstate alliesspawns_laatste invisible
		setstate alliesspawn_laatste invisible
		remove
	}
}

//=============================================================================
//=== Tank 1 (objective 1)
//=============================================================================
//	accum 0, script lock
//	accum 1, current spline-path number
//	accum 2, tracks state
//	accum 3, bit 0	death status		(0=dead, 1=alive)
//		 bit 1	stuck status		(0=not stuck, 1=stuck)
//		 bit 2	players nearby		(0=no players, 1=players)
//		 bit 3	moving status		(0=not moving, 1=moving)
//		 bit 4	temp register
//		 bit 5	message-flag		(0=no message, 1=message)
//		 bit 6	visible state		(0=dead, 1=alive)
//	accum 4, stop counter
//	accum 7, de brug (0=kapot, 1=gemaakt)
//	accum 8, de deur (0=gesloten, 1=open)
//

//info_notnull
tank1_sound
{
	trigger start
	{
		trigger tank1 sound_start
		wait 3400
		trigger tank1 sound_move
	}

	trigger stop
	{
		trigger tank1 sound_stop
		wait 1400
		trigger tank1 sound_idle
	}

	trigger death
	{
		trigger tank1 sound_death
		wait 3400
		trigger tank1 sound_idle
	}

	trigger rebirth
	{
		trigger tank1 sound_rebirth
		wait 3400
		trigger tank1 sound_idle
	}
}

//script_mover
tank1
{
	// ===========================================================================================
	spawn
	{
		wait 1000

		constructible_chargebarreq 1.0
		constructible_constructxpbonus 10
		constructible_destructxpbonus 10

		// de tank op het pad plaatsen (1e spline)
		followspline 0 tank1padstart 10000 wait length -64
		accum 1 set 0

		allowtankenter no
		allowtankexit yes

		trigger self sound_idle
		trigger self tracks_stop
	}


	// ===========================================================================================
	// script lockouts. Om tegen te gaan dat 1 routine meerdere malen, tegelijkertijd wordt uitgevoerd.
	trigger script_lock
	{
		accum 0 inc 1
	}

	trigger script_unlock
	{
		accum 0 inc -1
	}


	// ===========================================================================================
	// tracks. De rupsbanden
	trigger tracks_stop
	{
		accum 2 abort_if_equal 0
		accum 2 set 0

		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_r
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_r
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_l
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_l
		remapshaderflush
	}

	trigger tracks_forward
	{
		accum 2 abort_if_equal 1
		accum 2 set 1

		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_forward
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_forward
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_forward
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_forward
		remapshaderflush
	}

	trigger tracks_turn_left
	{
		accum 2 abort_if_equal 2
		accum 2 set 2

		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_forward
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_forward
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_backward
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_backward
		remapshaderflush
	}

	trigger tracks_turn_right
	{
		accum 2 abort_if_equal 3
		accum 2 set 3

		remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_backward
		remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_backward
		remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_forward
		remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_forward
		remapshaderflush
	}


	// ===========================================================================================
	// sound.
	trigger sound_idle
	{
		stopsound
		playsound sound/vehicles/tank/tank_idle.wav looping volume 512
	}

	trigger sound_start
	{
		stopsound
		playsound sound/vehicles/tank/tank_revup.wav volume 196
	}

	trigger sound_move
	{
		stopsound
		playsound sound/vehicles/tank/tank_move.wav looping volume 512
	}

	trigger sound_stop
	{
		stopsound
		playsound sound/vehicles/tank/tank_revdown.wav volume 196
	}

	trigger sound_death
	{
		stopsound
		playsound sound/vehicles/tank/tank_stop.wav volume 256
	}

	trigger sound_rebirth
	{
		stopsound
		playsound sound/vehicles/tank/tank_start.wav volume 196
	}

	trigger sound_fire
	{
		stopsound
		playsound sound/vehicles/tank/tank_fire.wav volume 196
	}


	// ===========================================================================================
	// Enable/Disable. Tbv. het begeleiden van de tank door spelers.
	trigger tank_enable
	{
		trigger self stuck_check
		accum 3 abort_if_bitset 1 		// stuck check
		accum 4 set 0				// reset stop counter
		accum 3 bitset 2			// set player check
		accum 3 abort_if_bitset 3 		// already following spline
		accum 0 abort_if_not_equal 0		// are we not in a script lockout?
		accum 3 abort_if_bitset 0 		// death check

		trigger self script_lock		//--------------------------------------------

		trigger tank1_sound start		// geluid van een startende tank laten horen

		startanimation 55 10 15 nolerp norandom	// de tank "opstarten" model-animatie
		wait 666
		startanimation 5 40 15 nolerp norandom
		wait 500
		trigger self tracks_forward		// de rupsbanden bewegen vooruit

		trigger self script_unlock		//--------------------------------------------

		trigger self move			// de tank laten rijden..
	}

	trigger tank_disable
	{
		accum 4 inc 1				// stop counter verhogen
		accum 4 abort_if_less_than 4		// 4 second ride

		accum 3 bitreset 2			// reset player check

		trigger self deathcheck			// test of de tank kapot is
	}


	// ===========================================================================================
	// stuck checking. Test of de tank verder kan/mag rijden. (ivm een mogelijke barricade ed.)
	trigger stuck_check
	{
		accum 3 bitreset 1			// (0=not stuck, 1=stuck)

		trigger self stuck_check_scriptlockout
		trigger self stuck_check_de_deur_closed
		trigger self stuck_check_finished
		trigger self stuck_check_bridge_unbuild
	}

	trigger stuck_check_scriptlockout
	{
		accum 0 abort_if_equal 0
		accum 3 bitset 1			// doe alsof de tank vast staat als we in een script-lock zitten
	}

	trigger stuck_check_finished
	{
		accum 1 abort_if_less_than 63		// tank1pad0 t/m tank1pad62
		accum 3 bitset 1
	}


	// ===========================================================================================
	// stop check. Test of de tank moet stoppen.
	trigger stopcheck_setup
	{
		accum 3 bitset 4			// stop if we're stuck/no-one's pushing :)

		accum 3 abort_if_not_bitset 2		// no one in the trigger, abort

		trigger self stuck_check		// call the stop check function
		accum 3 abort_if_bitset 1		// we're stuck so break out

		accum 3 bitreset 4			// we're free to move
	}

	trigger stopcheck
	{
		trigger self stopcheck_setup
		accum 3 abort_if_not_bitset 4

		trigger self script_lock		//--------------------------------------------

		trigger tank1_sound stop		// geluid van een stoppende tank laten horen

		trigger self tracks_stop		// de rupsbanden staan stil

		startanimation 45 10 15 nolerp norandom	// animatie van een stoppende tank
		wait 666
		startanimation 0 1 15 nolerp norandom
		wait 900

		trigger self script_unlock		//--------------------------------------------
		resetscript
	}


	// ===========================================================================================
	// Death/Rebirth
	trigger deathcheck
	{
		accum 3 abort_if_not_bitset 0		// are we dead?
		accum 3 abort_if_bitset 6		// are we not already visibly dead?
		accum 3 abort_if_bitset 3		// are we not following a spline?
		accum 0 abort_if_not_equal 0		// are we not in a script lockout?

		accum 3 bitset 6			// we're now visibly dead

		accum 3 bitset 5

		// het model van de kapotte tanklaten zien.
		changemodel models/mapobjects/tanks_sd/churchhill_broken.md3

		// de rook laten zien.
		setstate tank1_smoke default

		allowtankenter no
		allowtankexit yes

		kill tank1_construct			// ervoor zorgen dat de tank weer kan worden gemaakt

		trigger self sound_death		// een kapotte tank laten horen

		trigger self script_lock		//--------------------------------------------

		trigger self tracks_stop		// de rupsbanden laten stoppen

		startanimation 45 10 15 nolerp norandom	// de animatie van een stoppende tank afspelen
		wait 666
		startanimation 0 1 15 nolerp norandom

		trigger self script_unlock		//--------------------------------------------

		resetscript
	}

	rebirth
	{
		accum 3 bitreset 6 			// we're visibly alive
		accum 3 bitreset 0 			// we're alive again

//		wm_announce "The Churchill tank has been repaired."

		trigger self script_lock		//--------------------------------------------

		// het model van de gerepareerde  tank laten zien.
		changemodel models/mapobjects/tanks_sd/churchhill.md3

		setstate tank1_smoke invisible		// rook uitschakelen

		allowtankenter yes
		allowtankexit yes

		trigger tank1_sound rebirth		// geluid van een startende tank laten horen
		wait 500

		trigger self script_unlock		//--------------------------------------------
	}

	death
	{
		accum 3 bitset 0
	}




	// ===========================================================================================
	// Movement. Tbv de tank bewegingen

	
	trigger run_continue
	{
		accum 1 inc 1
		trigger self deathcheck
		trigger self stopcheck
		trigger self move
	}

	trigger move
	{
		trigger self move_check
		wait 500
		trigger self move
	}
	
	//=============================================================================================
	//de deur 
	
	
	trigger de_deur_open
	{
    		accum 8 set 1
  	}
  	trigger de_deur_dicht
  	{
    		//accum 8 set 0
  	}
	trigger stuck_check_de_deur_closed
	{
		// alleen als de tank op padspline x is,
		// controleren of de deur open is..
		accum 1 abort_if_not_equal 21		// de tank staat nu vlak voor de deur??
		accum 8 abort_if_equal 1		// is de deur wel open??
		accum 3 bitset 1			// stuck
	}
	trigger bridge_build
	{
		accum 7 set 1
	}
	trigger bridge_unbuild
	{
		accum 7 set 0
	}
	trigger stuck_check_bridge_unbuild
	{
		//alleen controleren als de tank op padspline x is,
		//controleren of de brug gemaakt is.
		accum 1 abort_if_not_equal 31		//de tank staat voor de brug??
		accum 7 abort_if_equal 1		//is brug wel gemaakt??
		accum 3 bitset 1			//stuck
	}

	trigger move_check
	{
		trigger self stuck_check
		accum 3 abort_if_bitset 1

		// List of splines
		accum 1 trigger_if_equal 0 tank1 move_000
		accum 1 trigger_if_equal 1 tank1 move_001
		accum 1 trigger_if_equal 2 tank1 move_002
		accum 1 trigger_if_equal 3 tank1 move_003
		accum 1 trigger_if_equal 4 tank1 move_004
		accum 1 trigger_if_equal 5 tank1 move_005
		accum 1 trigger_if_equal 6 tank1 move_006
		accum 1 trigger_if_equal 7 tank1 move_007
		accum 1 trigger_if_equal 8 tank1 move_008
		accum 1 trigger_if_equal 9 tank1 move_009
		accum 1 trigger_if_equal 10 tank1 move_010
		accum 1 trigger_if_equal 11 tank1 move_011
		accum 1 trigger_if_equal 12 tank1 move_012
		accum 1 trigger_if_equal 13 tank1 move_013
		accum 1 trigger_if_equal 14 tank1 move_014
		accum 1 trigger_if_equal 15 tank1 move_015	
		accum 1 trigger_if_equal 16 tank1 move_016	
		accum 1 trigger_if_equal 17 tank1 move_017	
		accum 1 trigger_if_equal 18 tank1 move_018	
		accum 1 trigger_if_equal 19 tank1 move_019	
		accum 1 trigger_if_equal 20 tank1 move_020
		accum 1 trigger_if_equal 21 tank1 move_021

//		accum 1 trigger_if_equal 22 tank1 move_022	//de tank moet gewoon rijden door de_deur
//		accum 1 trigger_if_equal 23 tank1 move_023
//		accum 1 trigger_if_equal 24 tank1 move_024

		accum 1 trigger_if_equal 22 tank1 move_025
		accum 1 trigger_if_equal 23 tank1 move_026
		accum 1 trigger_if_equal 24 tank1 move_027
		accum 1 trigger_if_equal 25 tank1 move_028
		accum 1 trigger_if_equal 26 tank1 move_029
		accum 1 trigger_if_equal 27 tank1 move_030
		accum 1 trigger_if_equal 28 tank1 move_031
		accum 1 trigger_if_equal 29 tank1 move_032
		accum 1 trigger_if_equal 30 tank1 move_033
		accum 1 trigger_if_equal 31 tank1 move_034
		accum 1 trigger_if_equal 32 tank1 move_035
		accum 1 trigger_if_equal 33 tank1 move_036
		accum 1 trigger_if_equal 34 tank1 move_037
		accum 1 trigger_if_equal 35 tank1 move_038
		accum 1 trigger_if_equal 36 tank1 move_039
		accum 1 trigger_if_equal 37 tank1 move_040
		accum 1 trigger_if_equal 38 tank1 move_041
		accum 1 trigger_if_equal 39 tank1 move_042
		accum 1 trigger_if_equal 40 tank1 move_043
		accum 1 trigger_if_equal 41 tank1 move_044
		accum 1 trigger_if_equal 42 tank1 move_045
		accum 1 trigger_if_equal 43 tank1 move_046
		accum 1 trigger_if_equal 44 tank1 move_047
		accum 1 trigger_if_equal 45 tank1 move_048
		accum 1 trigger_if_equal 46 tank1 move_049
		accum 1 trigger_if_equal 47 tank1 move_050
		accum 1 trigger_if_equal 48 tank1 move_051
		accum 1 trigger_if_equal 49 tank1 move_052
		accum 1 trigger_if_equal 50 tank1 move_053
		accum 1 trigger_if_equal 51 tank1 move_054
		accum 1 trigger_if_equal 52 tank1 move_055
		accum 1 trigger_if_equal 53 tank1 move_056
		accum 1 trigger_if_equal 54 tank1 move_057
		accum 1 trigger_if_equal 55 tank1 move_058
		accum 1 trigger_if_equal 56 tank1 move_059
		accum 1 trigger_if_equal 57 tank1 move_060
		accum 1 trigger_if_equal 58 tank1 move_061
		accum 1 trigger_if_equal 59 tank1 move_062
	}
	trigger move_000
	{
		trigger self tracks_forward
		accum 3 bitset 3			// Mark as moving
		followspline 0 tank1pad0 50 wait length -64
		accum 3 bitreset 3			// Mark as not moving
		trigger self run_continue
	}
	trigger move_001
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad1 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_002
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad2 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_003
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad3 50 wait length -64
		accum 3 bitreset 3


		trigger self script_lock		//--------------------------------------------

		// de tank moet de dynamite-objective muur half kapot schieten
		trigger tank1_sound stop		// geluid van een stoppende tank laten horen
		trigger self tracks_stop		// de rupsbanden staan stil

		startanimation 45 10 15 nolerp norandom	// animatie van een stoppende tank
		wait 666
		startanimation 0 1 15 nolerp norandom
		wait 900

		trigger tank1_turret turn30_right	// koepel laten draaien
		wait 2230	
		trigger self startfire			// schieten
		trigger poort_hurt show			// schade toebrengen aan diegenen die voor de tank staan
		wait 200
		trigger self stopfire
		trigger poort_hurt hide			// het schot is gelost, geen schade meer toebrengen..

		alertentity poort_explosion		// explosie effect weergeven
		trigger poort hide

		wm_announce "^2 The tank has destroyed the gate!!"

		trigger tank1_turret turn_original	// koepel terug laten draaien

		wait 3230

		trigger self script_unlock		//--------------------------------------------
		trigger self sound_idle
		trigger self run_continue

	}
	trigger move_004
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad4 50 wait length -64
		accum 3 bitreset 3

		trigger self run_continue
	}

	trigger move_005
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad5 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_006
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad6 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_007
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad7 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_008
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad8 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_009
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad9 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_010
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad10 50 wait length -64
		accum 3 bitreset 3

		trigger self script_lock		//--------------------------------------------

		// de tank moet de dynamite-objective muur half kapot schieten
		trigger tank1_sound stop		// geluid van een stoppende tank laten horen
		trigger self tracks_stop		// de rupsbanden staan stil

		startanimation 45 10 15 nolerp norandom	// animatie van een stoppende tank
		wait 666
		startanimation 0 1 15 nolerp norandom
		wait 900

		trigger tank1_turret turn40_left	// koepel vd tank laten draaien
		wait 2000
		trigger self startfire			// schieten
		trigger gate_hurt show			// schade toebrengen aan diegenen die voor de tank staan
		wait 200
		trigger self stopfire
		trigger gate_hurt hide			// het schot is gelost, geen schade meer toebrengen..

		alertentity gateexplosion		// explosie effect weergeven (entity is er nog niet)
		trigger gate hide
		trigger bunker_gate_puin show

		wm_announce "^2 The tank has destroyed the Bunker entrance!!"

		trigger tank1_turret turn_original	// koepel terug laten draaien

		wait 2500

		trigger self script_unlock		//--------------------------------------------
		trigger self sound_idle
		trigger self run_continue
	}
	trigger move_011
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad11 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_012
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad12 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_013
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad13 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_014
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad14 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_015
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad15 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_016
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad16 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_017
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad17 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_018
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad18 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_019
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad19 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_020
	{
		trigger self tracks_forward
		accum 3 bitset 3



		followspline 0 tank1pad20 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_021
	{
		
		trigger self tracks_forward
		accum 3 bitset 3

		trigger de_deur tank_voor_de_deur

		followspline 0 tank1pad21 50 wait length -64
		followspline 0 tank1pad22 50 wait length -64
		followspline 0 tank1pad23 50 wait length -64
		followspline 0 tank1pad24 50 wait length -64

		setstate axisspawns_dozen default	//command-map/vlag bijwerken, axis vlag erbij
		alertentity axisspawn_dozen

		setautospawn "Gate" 0 		// spawn voor de Axis
		setautospawn "Bunker" 1 	// spawn voor de Allies

		setstate axisspawns_huisje invisible
		alertentity axisspawn_huisje

		wm_axis_respawntime 10
		wm_allied_respawntime 10

		setstate alliesspawns_tonnen invisible	

		trigger de_deur tank_voorbij

		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_025
	{
		trigger self tracks_forward		

		wm_announce "^3 Stage 1 Completed! + 15minutes!!"
		wm_set_round_timelimit 30

		accum 3 bitset 3
		followspline 0 tank1pad25 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_026
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad26 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_027
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad27 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_028
	{
		trigger self tracks_forward

		trigger de_deur dicht

		wm_announce "^3 An Vulcano erupted Fall Back!!!"

		trigger stage1_lava high
		trigger stage1_hurt high
		
		setstate light_blue invisible
		setstate light_red default

		accum 3 bitset 3
		followspline 0 tank1pad28 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue

		wm_objective_status 2 0 1		
		wm_objective_status 2 1 2
	}
	trigger move_029
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad29 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_030
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad30 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_031
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad31 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_032
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad32 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_033
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad33 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_034
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad34 50 wait length -64
		accum 3 bitreset 3

		trigger bridge tank_on

		trigger self run_continue
	}
	trigger move_035
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad35 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_036
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad36 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_037
	{
		trigger self tracks_forward

		wm_announce "^1 The Tank is over the bridge!!"
		trigger bridge tank_off

		accum 3 bitset 3
		followspline 0 tank1pad37 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue

		wm_objective_status 3 0 1		
		wm_objective_status 3 1 2
	}
	trigger move_038
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad38 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_039
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad39 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_040
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad40 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_041
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad41 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_042
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad42 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_043
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad43 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_044
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad44 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_045
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad45 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_046
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad46 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_047
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad47 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_048
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad48 50 wait length -64

		setautospawn "AlliedVulcano" 1		//spawn voor de allies
		setstate alliesspawns_tunnel invisible	//weg dr mee

		setstate axisspawns_tunnel default
		alertentity axisspawn_tunnel

		setautospawn "Bunker Axis" 0		// axis spawnen daar nu
		setstate axisspawns_dozen invisible
		alertentity axisspawn_dozen

		wm_announce "^2 NEW SPAWNS!!!"

		setstate allied_door default
		setstate axis_door invisible

		setstate hurtvulcano invisible

		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_049
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad49 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_050
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad50 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_051
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad51 50 wait length -64
		accum 3 bitreset 3

		trigger self script_lock		//--------------------------------------------

		// de tank moet de dynamite-objective muur half kapot schieten
		trigger tank1_sound stop		// geluid van een stoppende tank laten horen
		trigger self tracks_stop		// de rupsbanden staan stil

		startanimation 45 10 15 nolerp norandom	// animatie van een stoppende tank
		wait 666
		startanimation 0 1 15 nolerp norandom
		wait 900
		trigger tank1_turret turn10_left
		wait 500
		trigger self startfire			// schieten
		trigger gang_muur_hurt show			// schade toebrengen aan diegenen die voor de tank staan
		setstate riool_gate_rubble default	
		wait 200
		trigger self stopfire
		trigger gang_muur_hurt hide			// het schot is gelost, geen schade meer toebrengen..

		alertentity gang_muurexplosion		// explosie effect weergeven (entity is er nog niet)
		trigger gang_muur hide

		wm_announce "^2 The tank has destroyed the Sewer!!"

		trigger tank1_turret turn_original
		wait 2500

		trigger self script_unlock		//--------------------------------------------

		trigger self run_continue
	}
	trigger move_052
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad52 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_053
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad53 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_054
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad54 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_055
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad55 50 wait length -64

		alertentity tank_break_effect
		setstate tank_break_wall_broken default
		setstate tank_break_wall invisible

		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_056
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad56 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_057
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad57 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_058
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad58 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_059
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad59 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_060
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad60 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_061
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad61 50 wait length -64
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger move_062
	{
		trigger self tracks_forward
		accum 3 bitset 3
		followspline 0 tank1pad62 50 wait length -64
		accum 3 bitreset 3

		trigger self script_lock		//--------------------------------------------

		// de tank moet schieten
		trigger tank1_sound stop		// geluid van een stoppende tank laten horen
		trigger self tracks_stop		// de rupsbanden staan stil

		startanimation 45 10 15 nolerp norandom	// animatie van een stoppende tank
		wait 666
		startanimation 0 1 15 nolerp norandom
		wait 900
		trigger tank1_turret turn90_right
		wait 4500
		trigger self startfire			// schieten
		trigger riool_muur_hurt show			// schade toebrengen aan diegenen die voor de tank staan
		wait 200
		trigger self stopfire
		trigger riool_muur_hurt hide			// het schot is gelost, geen schade meer toebrengen..

		alertentity riool_muurexplosion		// explosie effect weergeven (entity is er nog niet)
		trigger riool_muur hide
		setstate vulkaan_kapot default

		wm_announce "^2 The tank has made a hole in the vulcano!!"
		wait 1000
		wm_announce "^2 The tank has made a hole in the vulcano!!"
		wait 1000
		wm_announce "^2 The tank has made a hole in the vulcano!!"


		setstate axisspawns_AxisVulcano default	//command-map/vlag bijwerken, axis vlag erbij
		alertentity axisspawn_AxisVulcano

		setautospawn "AxisVulcano" 0		//spawn voor de axis
		setautospawn "Flag" 1			//spawn voor de allies

		wm_axis_respawntime 10
		wm_allied_respawntime 15

		setstate alliesspawns_vulkaan invisible
		setstate axisspawns_tunnel invisible
		alertentity axisspawn_tunnel

		setstate vulkaan_clip invisible

		trigger vulcano_sound on

		wait 1000

//		trigger self script_unlock		//--------------------------------------------


	}


	// ===========================================================================================
	// Tank-koepel.
	trigger startfire
	{
		startanimation 67 8 10 nolerp norandom noloop
		trigger self sound_fire
		trigger tank1_flash startfire
		
	}

	trigger stopfire
	{
		startanimation 0 1 15 nolerp norandom
		trigger tank1_flash stopfire
	}

	//--
	trigger damage_tank
	{
		changemodel models/mapobjects/tanks_sd/churchhill_broken.md3
		setstate tank1_smoke default
		allowtankenter no
		allowtankexit yes
		trigger self sound_death
		trigger self tracks_stop
	}


}

//=======================================================
//target_script_trigger
tank1_disabler
{
	trigger run
	{
		trigger tank1 tank_disable
	}
}

//=======================================================
//target_script_trigger
tank1_enabler
{
	trigger run
	{
		trigger tank1 tank_enable
	}
}

//=======================================================
//trigger_multiple
tank1_trigger
{
	spawn
	{
		wait 100
		attachtotag tank1 tag_turret
	}
}

//=======================================================
//trigger_objective_info
tank1_build
{
	spawn
	{
		wait 100
		attachtotag tank1 tag_turret
	}
}

//=======================================================
//func_constructible
tank1_construct
{
	spawn
	{
		wait 400

		kill tank1

		constructible_class 2
		constructible_health 1200
		constructible_constructxpbonus 10
		constructible_destructxpbonus 10
	}

	built final
	{
		alertentity tank1
		wm_announce "The Churchill tank has been repaired."
	}

	trigger final_pos
	{
		constructible_constructxpbonus 5
		constructible_destructxpbonus 5
	}

	trigger remove
	{
		remove
	}
}

//=========================================================
// koepel vd tank

tank1_turret
{
	spawn
	{
		wait 500
		attachtotag tank1 tag_turret
	}
	trigger turn10_right
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 -10 0 500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn20_right
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 -20 0 1000

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn30_right
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 -30 0 1500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn40_right
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 -40 0 2000

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn50_right
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 -50 0 2500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn60_right
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 -60 0 3000

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn70_right
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 -70 0 3500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn80_right
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 -80 0 4000

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn90_right
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 -90 0 4500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn10_left
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 10 0 500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn20_left
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 20 0 1000

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn30_left
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 30 0 1500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn40_left
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 40 0 2000

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn50_left
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 50 0 2500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn60_left
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 60 0 3000

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn70_left
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 70 0 3500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn80_left
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 80 0 4000

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn90_left
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 90 0 4500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
	trigger turn_original
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 256
		wait 730
		playsound sound/movers/motors/motor_loop_02.wav looping volume 256

		faceangles 0 0 0 2500

		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 256
		wait 730
		stopsound
	}
}


//=======================================================
tank1_smoke
{
	spawn
	{
		wait 300
		attachtotag tank1 tag_turret
		setstate tank1_smoke invisible
	}
}

//=======================================================
tank1_flash
{
	spawn
	{
 		attachtotag tank1_turret tag_flash
		setstate tank1_flash invisible
	}

	trigger startfire
	{
 		attachtotag tank1_turret tag_flash
		setstate tank1_flash default
		//wait 50
	}
	trigger stopfire
	{
		setstate tank1_flash invisible
		//wait 50
	}
}
//=======================================================

poort
{
	trigger hide
	{
	setstate poort invisible
 	}
  	trigger show
	{
 	setstate poort default
 	}
}

poort_hurt
{
	trigger hide
	{
	setstate poort_hurt invisible
 	}
  	trigger show
	{
 	setstate poort_hurt default
 	}
}

gate
{
	trigger hide
	{
	setstate gate invisible
	
 	}
  	trigger show
	{
 	setstate gate default
 	}
}

gate_hurt
{
	trigger hide
	{
	setstate gate_hurt invisible
 	}
  	trigger show
	{
 	setstate gate_hurt default
 	}
}

gang_muur
{
	trigger hide
	{
	setstate gang_muur invisible
	setstate gang_muur_deur invisible
 	}
  	trigger show
	{
 	setstate gang_muur default
	setstate gang_muur_deur default
 	}
}

riool_muur
{
	trigger hide
	{
	setstate riool_muur invisible
	setstate riool_kruis1 invisible
	setstate riool_kruis2 invisible
	setstate riool_kruis3 invisible
	setstate riool_kruis4 invisible
	setstate riool_muur_dmg default
	setstate riool_wiel default
	setstate riool_draden default
 	}
  	trigger show
	{
 	setstate riool_muur default
 	}
}

bunker_gate_puin
{
	trigger hide
	{
	setstate bunker_gate_puin invisible
 	}
  	trigger show
	{
 	setstate bunker_gate_puin default
 	}
}
//--------------------------------------------\\
//--------------------<BruG>------------------\\
//--------------------------------------------\\

// accum 0: 0=kapot, 1=gemaakt
// accum 1: 0=tankerop, 1=tankeraf


bridge
{
	// Deze entity komt in de map
	spawn
	{
		accum 0 set 0
		accum 1 set 1
		accum 2 set 0
		wait 150

		trigger bridge showcrates
		setstate bridge_static invisible

		constructible_class 3
		constructible_weaponclass 3
		constructible_chargebarreq 2
		//constructible_health 350
		constructible_duration 5000
		constructible_constructxpbonus 20
		constructible_destructxpbonus 20
	}

	// kisten+vlag
	trigger showcrates
	{
		setstate bridge_materials default
		setstate bridge_materials_clip default
		setstate bridge_flag default

		trigger tank1 bridge_unbuild

		accum 2 abort_if_equal 0
		
		
	}
	trigger hidecrates
	{
		setstate bridge_materials invisible
		setstate bridge_materials_clip invisible
		setstate bridge_flag invisible

		trigger tank1 bridge_build	

	}
	trigger tank_on
	{
		accum 1 set 0	//tank is op de brug
		setstate bridge invisible
		setstate bridge_static default
	}
	trigger tank_off
	{
		accum 1 set 1	//tank is van de brug
		setstate bridge default
		setstate bridge_static invisible
	}

	buildstart final
	{

		trigger self showcrates
	}
	built final
	{
		wm_objective_status 3 0 1
		wm_objective_status 3 1 2
		trigger self hidecrates

	}

	decayed final
	{
		trigger self showcrates
	}
	death
	{
		wm_announce "^3 The Allies have destroyed the bridge!!!"
		wm_objective_status 3 0 0
		wm_objective_status 3 1 0
		trigger self showcrates

	}
}

//----------<>--------------<<DE DEUR>>------------------------<>----------------\\

// toestand onthouden:
// accum 0: 0=gesloten, 1=open
// accum 1: 0=tank niet voorbij, 1=tank voorbij de deur
// accum 2: 0=announce geactiveerd, 1=announce voorbij


de_deur
{
	spawn
	{
		wait 100
		setposition de_deur_dicht_pad
		accum 0 set 0
		accum 1 set 0
		accum 2 set 1
	}
	trigger open
	{
		//accum 0 abort_if_equal 1
		//accum 1 abort_if_equal 1
		//accum 2 abort_if_equal 0
		setstate light_red default
		setstate light_blue invisible
		setstate light_normal invisible
		accum 2 set 0

		stopsound
		playsound sound/movers/misc/garage_door_start_01.wav volume 512
		wait 730
		stopsound
		playsound sound/movers/misc/garage_door_loop_01.wav looping volume 512

		gotomarker de_deur_open_pad 100 deccel wait

		stopsound
		playsound sound/movers/misc/garage_door_end_01.wav volume 512
		wait 730
		stopsound

		accum 0 set 1
		trigger tank1 de_deur_open
		accum 2 set 1

		wm_objective_status 2 0 1
		wm_objective_status 2 1 2
	}
	trigger dicht
	{
		//accum 0 abort_if_equal 0
		//accum 2 abort_if_equal 0
		setstate light_blue default
		setstate light_red invisible
		accum 2 set 0

		stopsound
		playsound sound/movers/misc/garage_door_start_01.wav volume 512
		wait 730
		stopsound
		playsound sound/movers/misc/garage_door_loop_01.wav looping volume 512

		gotomarker de_deur_dicht_pad 100 deccel wait

		stopsound
		playsound sound/movers/misc/garage_door_end_01.wav volume 512

		accum 0 set 0
		trigger tank1 de_deur_dicht

		accum 1 abort_if_equal 1

		accum 2 set 1

		wm_objective_status 2 0 0
		wm_objective_status 2 1 0

	}
	trigger tank_voorbij
	{
		accum 1 set 1		//tank is erdoor dus kan niet nog een keer worden geopend
		accum 2 set 1		//tank is erdoor dus hij kan weer dicht

	}
	trigger tank_voor_de_deur
	{
		accum 2 set 0		//doen alsof de deur nog opengaat (kan niet meer dicht)
	}	
}

de_deur_fiu
{

	activate allies
	{
		trigger speaker_panel on
		trigger de_deur dicht

	}	
	activate axis
	{
		trigger speaker_panel on
		trigger de_deur open


	}	
}

speaker_panel
{
	spawn
	{
	}
	trigger on
	{
		playsound sound/movers/switches/switch_02.wav volume 256
	}
}
//------------<>-----------<<Stage1 Lava>>---------------<>------------------\\

stage1_lava
{
	spawn
	{
		wait 1000
		setposition stage1_lavalow
	}
	trigger high
	{
		gotomarker stage1_lavahigh 10 deccel wait
	}
}
stage1_hurt
{
	spawn
	{
		wait 1000
		setposition stage1_lavalow
	}
	trigger high
	{
		gotomarker stage1_lavahigh 10 deccel wait
	}
}
//---------<>--------------<<DE MUUR>>----------------------<>-----------------\\
//DE MUUR
de_muur
{
	// Deze entity komt in de map
	spawn
	{
	set
		{
		constructible_class 1			// dynamiet
		constructible_weaponclass 1		// dynamiet
		constructible_chargebarreq 1.5
		constructible_constructxpbonus 0
		constructible_destructxpbonus 15
		constructible_health 100
		//constructible_duration 2500
			}
	}

	// Deze entity wordt vernietigd
	death
	{



		// deze func_constructible verwijderen uit de map
		trigger self remove
	}

	trigger remove
	{

		trigger spawnflag muur_weg	//axis moeten dr nu spawnen
		setstate spawnflag invisible	//vlag weg

		remove		//muur weg
	}
}

//-----------<>------------<<DE FLAG>>-------------<>------------\\

// de vlag 
spawnflag
{
	spawn
	{
		// welk team heeft de vlag?
		accum 0 set 1 //allies
	}

	trigger axis_capture
	{
		// is de vlag al van de axis?
		accum 0 abort_if_equal 0
		accum 0 set 0 //axis

		wm_announce "The Axis captured the Flag."

		alertentity spawns_flag		//command-map/vlag bijwerken

		setautospawn "Flag" 0	//axis spawnen hier nu automatisch

		wm_objective_status 4 0 1
		wm_objective_status 4 1 2
	}

	trigger allied_capture
	{
		// is de vlag al van de allies?
		accum 0 abort_if_equal 1
		accum 0 set 1 //allies

		wm_announce "The Allies reclaimed the Flag."

		alertentity spawns_flag

		setautospawn "AxisVulcano" 0	//axis spawnen ergens anders

		wm_objective_status 4 0 0
		wm_objective_status 4 1 0
	}
	trigger muur_weg
	{
		accum 0 abort_if_equal 0
		accum 0 set 0
	
		alertentity spawns_flag
		setautospawn "Flag" 0

	}
}

















//==================================================================================================\\
//=========================================truck1===================================================\\
//==================================================================================================\\
//-----------------------------------------------
//target_speaker
truck_sound
{
	spawn
	{
		wait 500
		attachtotag truck tag_wfront
		trigger self sound_idle
	}

	trigger start
	{
		trigger self sound_start
		wait 950
		trigger self sound_move
	}

	trigger stop
	{
		trigger self sound_stop
		wait 950
		trigger self sound_idle
	}

	trigger sound_idle
	{
		playsound sound/vehicles/truck/truck_idle.wav looping
	}

	trigger sound_start
	{
		stopsound
		playsound sound/vehicles/truck/truck_revup.wav volume 96
	}

	trigger sound_move
	{
		playsound sound/vehicles/truck/truck_move.wav looping
	}

	trigger sound_stop
	{
		stopsound
		playsound sound/vehicles/truck/truck_revdown.wav volume 96
	}

	trigger sound_death
	{
		stopsound
		playsound sound/vehicles/truck/truck_stop.wav volume 96
	}
}

//-----------------------------------------------
//script_mover
//	accum 0, script lock
//	accum 1, current spline-path number
//	accum 2, tracks state
//	accum 3, bit 0	death status		(0=dead, 1=alive)
//		 bit 1	stuck status		(0=not stuck, 1=stuck)
//		 bit 2	players nearby		(0=no players, 1=players)
//		 bit 3	moving status		(0=not moving, 1=moving)
//		 bit 4	temp register
//		 bit 5	message-flag		(0=no message, 1=message)
//		 bit 6	visible state		(0=dead, 1=alive)
//	accum 4, stop counter
truck
{
	// =============================================
	spawn
	{
		accum 0 set 0
		accum 1 set 0
		accum 2 set 0
		accum 3 set 0
		accum 3 bitset 0
		accum 3 bitset 6
		accum 4 set 0
		wait 1000
		setstate truck_whitesmoke default
		setstate truck_trigger default
		setstate truck_build default
		followspline 0 truck1padstart 10000 wait length 200
	}

	// =============================================
	trigger script_lock
	{
		accum 0 set 1
	}
	trigger script_unlock
	{
		accum 0 set 0
	}

	// =============================================
	trigger wheels_forward
	{
		trigger truck_fwheels forward
		trigger truck_bwheels forward
	}

	trigger wheels_backward
	{
		trigger truck_fwheels backward
		trigger truck_bwheels backward
	}

	trigger wheels_stop
	{
		trigger truck_fwheels stop
		trigger truck_bwheels stop
	}

	// =============================================
	trigger truck_enable
	{
		trigger self stuck_check
		accum 3 abort_if_bitset 1
		accum 4 set 0
		accum 3 bitset 2
		accum 3 abort_if_bitset 3
		accum 0 abort_if_not_equal 0
		accum 3 abort_if_not_bitset 0
//		trigger self script_lock		//--------------------------------------------
		trigger truck_sound start
		trigger self wheels_forward
//		trigger self script_unlock		//--------------------------------------------
		trigger self move
	}

	trigger truck_disable
	{
		accum 4 inc 1
		accum 4 abort_if_less_than 2
		accum 3 bitreset 2
		trigger self deathcheck
	}

	// =============================================
	trigger stuck_check
	{
		accum 3 bitreset 1
		trigger self stuck_check_barrier_build
		trigger self stuck_check_scriptlockout
		trigger self stuck_check_finished
	}
	trigger stuck_check_scriptlockout
	{
		accum 0 abort_if_equal 0
		accum 3 bitset 1
	}
	trigger stuck_check_finished
	{
		accum 1 abort_if_less_than 33
		accum 3 bitset 1
	}
	trigger stuck_check_barrier_build
	{
		accum 1 abort_if_not_equal 26	//alleen bij spline 26 stoppen
		accum 7 abort_if_equal 0	//mag doorgaan als barrier niet gemaakt is
		accum 3 bitset 1		//stoppen
	}
	trigger barrier_build
	{
		accum 7 set 1
	}
	trigger barrier_unbuild
	{
		accum 7 set 0
	}


	// =============================================
	trigger stopcheck_setup
	{
		accum 3 bitset 4
		accum 3 abort_if_not_bitset 2
		trigger self stuck_check
		accum 3 abort_if_bitset 1
		accum 3 bitreset 4
	}

	trigger stopcheck
	{
		trigger self stopcheck_setup
		accum 3 abort_if_not_bitset 4
		trigger self script_lock		//--------------------------------------------
		trigger truck_sound stop
		trigger self wheels_stop
		trigger self script_unlock		//--------------------------------------------
		resetscript
	}

	// =============================================
	trigger deathcheck
	{
		accum 3 abort_if_bitset 0
		accum 3 abort_if_not_bitset 6
		accum 3 abort_if_bitset 3
		accum 0 abort_if_not_equal 0
		accum 3 bitreset 6
		wm_announce "^5The truck has been damaged."
		trigger truck_body damaged_model
		trigger self smoker
		setstate truck_whitesmoke invisible
		kill truck_construct
//		trigger self script_lock		//--------------------------------------------
		trigger truck_sound sound_death
		trigger self wheels_stop
//		trigger self script_unlock		//--------------------------------------------
		resetscript
	}
	trigger smoker
	{
		accum 1 abort_if_equal 100
		setstate truck_blacksmoke default
	}

	rebirth
	{
		accum 3 bitset 6
		accum 3 bitset 0
//		trigger self script_lock		//--------------------------------------------
		trigger truck_body repaired_model
		setstate truck_blacksmoke invisible
		setstate truck_whitesmoke default
//		trigger self script_unlock		//--------------------------------------------
	}

	death
	{
		accum 3 bitreset 0
	}

	// =============================================
	trigger move_check
	{
		trigger self stuck_check
		accum 3 abort_if_bitset 1
		trigger self dispatch
	}

	trigger move
	{
		trigger self move_check
		wait 500
		trigger self move
	}

	trigger run_continue
	{
		trigger self deathcheck
		trigger self stopcheck
		trigger self move
	}

	trigger run_1
	{
		accum 3 bitset 3
		followspline 0 truck1pad0 125 wait length 200
		accum 1 set 1
		accum 3 bitreset 3
		trigger self run_continue

		wm_axis_respawntime 10
		wm_allied_respawntime 10
	}
	trigger run_2
	{
		accum 3 bitset 3
		followspline 0 truck1pad1 125 wait length 200
		accum 1 set 2
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_3
	{
		accum 3 bitset 3
		followspline 0 truck1pad2 125 wait length 200
		accum 1 set 3


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_4
	{
		accum 3 bitset 3
		followspline 0 truck1pad3 125 wait length 200
		accum 1 set 4


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_5
	{
		accum 3 bitset 3
		followspline 0 truck1pad4 125 wait length 200
		accum 1 set 5


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_6
	{
		accum 3 bitset 3
		followspline 0 truck1pad5 125 wait length 200
		accum 1 set 6


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_7
	{
		accum 3 bitset 3
		followspline 0 truck1pad6 125 wait length 200
		accum 1 set 7


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_8
	{
		accum 3 bitset 3
		followspline 0 truck1pad7 125 wait length 200
		accum 1 set 8


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_9
	{
		accum 3 bitset 3
		followspline 0 truck1pad8 125 wait length 200
		accum 1 set 9


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_10
	{
		accum 3 bitset 3
		followspline 0 truck1pad9 125 wait length 200
		accum 1 set 10


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_11
	{
		accum 3 bitset 3
		followspline 0 truck1pad10 125 wait length 200
		accum 1 set 11


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_12
	{
		accum 3 bitset 3
		followspline 0 truck1pad11 125 wait length 200
		accum 1 set 12


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_13
	{
		accum 3 bitset 3
		followspline 0 truck1pad12 125 wait length 200
		accum 1 set 13


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_14
	{
		accum 3 bitset 3
		followspline 0 truck1pad13 125 wait length 200
		accum 1 set 14


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_15
	{
		accum 3 bitset 3
		followspline 0 truck1pad14 125 wait length 200
		accum 1 set 15
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_16
	{
		accum 3 bitset 3
		followspline 0 truck1pad15 125 wait length 200
		accum 1 set 16
		accum 3 bitreset 3
		trigger self run_continue
	}

	trigger run_17
	{
		accum 3 bitset 3
		followspline 0 truck1pad16 125 wait length 200
		accum 1 set 17

		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_18
	{
		accum 3 bitset 3
		followspline 0 truck1pad17 125 wait length 200
		accum 1 set 18


		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_19
	{
		accum 3 bitset 3
		followspline 0 truck1pad18 125 wait length 200
		accum 1 set 19

		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_20
	{
		accum 3 bitset 3
		followspline 0 truck1pad19 125 wait length 200
		accum 1 set 20

		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_21
	{
		accum 3 bitset 3
		followspline 0 truck1pad20 125 wait length 200
		accum 1 set 21

		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_22
	{
		accum 3 bitset 3
		followspline 0 truck1pad21 125 wait length 200
		accum 1 set 22

		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_23
	{
		accum 3 bitset 3
		followspline 0 truck1pad22 125 wait length 200
		accum 1 set 23

		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_24
	{
		accum 3 bitset 3
		followspline 0 truck1pad23 125 wait length 200
		accum 1 set 24

		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_25
	{
		accum 3 bitset 3
		followspline 0 truck1pad24 125 wait length 200
		accum 1 set 25
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_26
	{
		accum 3 bitset 3
		followspline 0 truck1pad25 125 wait length 200
		accum 1 set 26
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_27
	{
		accum 3 bitset 3
		followspline 0 truck1pad26 125 wait length 200
		trigger truck_barrier truck_past
		accum 1 set 27
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_28
	{
		accum 3 bitset 3
		followspline 0 truck1pad27 125 wait length 200
		accum 1 set 28
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_29
	{
		accum 3 bitset 3
		followspline 0 truck1pad28 125 wait length 200
		accum 1 set 29
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_30
	{
		accum 3 bitset 3
		followspline 0 truck1pad29 125 wait length 200
		accum 1 set 30
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_31
	{
		accum 3 bitset 3
		followspline 0 truck1pad30 125 wait length 200
		accum 1 set 31
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_32
	{
		accum 3 bitset 3
		followspline 0 truck1pad31 125 wait length 200
		accum 1 set 32
		accum 3 bitreset 3
		trigger self run_continue
	}
	trigger run_33
	{
		accum 3 bitset 3
		followspline 0 truck1pad32 125 wait length 200
		accum 1 set 33
		accum 3 bitreset 3
		trigger self run_continue
	}

	trigger dispatch
	{
		trigger self dispatch0
		trigger self dispatch10
		trigger self dispatch20
		trigger self dispatch30
	}
	trigger dispatch0
	{
		accum 1 abort_if_less_than 0
		accum 1 abort_if_greater_than 9
		accum 1 trigger_if_equal 0 	truck run_1
		accum 1 trigger_if_equal 1 	truck run_2
		accum 1 trigger_if_equal 2	truck run_3
		accum 1 trigger_if_equal 3 	truck run_4
		accum 1 trigger_if_equal 4 	truck run_5
		accum 1 trigger_if_equal 5 	truck run_6
		accum 1 trigger_if_equal 6 	truck run_7
		accum 1 trigger_if_equal 7 	truck run_8
		accum 1 trigger_if_equal 8 	truck run_9
		accum 1 trigger_if_equal 9 	truck run_10
	}
	trigger dispatch10
	{
		accum 1 abort_if_less_than 10
		accum 1 abort_if_greater_than 19
		accum 1 trigger_if_equal 10	truck run_11
		accum 1 trigger_if_equal 11	truck run_12
		accum 1 trigger_if_equal 12	truck run_13
		accum 1 trigger_if_equal 13	truck run_14
		accum 1 trigger_if_equal 14	truck run_15
		accum 1 trigger_if_equal 15	truck run_16
		accum 1 trigger_if_equal 16	truck run_17
		accum 1 trigger_if_equal 17	truck run_18
		accum 1 trigger_if_equal 18	truck run_19
		accum 1 trigger_if_equal 19	truck run_20
	}
	trigger dispatch20
	{
		accum 1 abort_if_less_than 20
		accum 1 abort_if_greater_than 29
		accum 1 trigger_if_equal 20	truck run_21
		accum 1 trigger_if_equal 21	truck run_22
		accum 1 trigger_if_equal 22	truck run_23
		accum 1 trigger_if_equal 23	truck run_24
		accum 1 trigger_if_equal 24	truck run_25
		accum 1 trigger_if_equal 25	truck run_26
		accum 1 trigger_if_equal 26	truck run_27
		accum 1 trigger_if_equal 27	truck run_28
		accum 1 trigger_if_equal 28	truck run_29
		accum 1 trigger_if_equal 29	truck run_30
	}
	trigger dispatch30
	{
		accum 1 abort_if_less_than 30
		accum 1 abort_if_greater_than 37
		accum 1 trigger_if_equal 30	truck run_31
		accum 1 trigger_if_equal 31	truck run_32
		accum 1 trigger_if_equal 32	truck run_33
		accum 1 trigger_if_equal 33	truck run_34
		accum 1 trigger_if_equal 34	truck run_35
		accum 1 trigger_if_equal 35	truck run_36
		accum 1 trigger_if_equal 36	truck run_37
		accum 1 trigger_if_equal 37	truck run_38
	}
}

//target_script_trigger
truck_disabler
{
	trigger run
	{
		trigger truck truck_disable
	}
}
truck_enabler
{
	trigger run
	{
		trigger truck truck_enable
	}
}

//trigger_multiple
truck_trigger
{
	spawn
	{
		wait 500
		attachtotag truck tag_wback
	}
}

//trigger_objective_info
truck_build
{
	spawn
	{
		wait 500
		attachtotag truck tag_wback
	}
}

//func_constructible
truck_construct
{
	spawn
	{
		wait 400
		constructible_class 2
		constructible_health 1050
		constructible_chargebarreq 0.5
		constructible_duration 2000
		constructible_constructxpbonus 10
		constructible_destructxpbonus 10
	}
	built final
	{
		alertentity truck
		wm_announce "^5The truck has been repaired."
	}
	trigger remove
	{
		remove
	}
}

//target_smoke
truck_blacksmoke
{
	spawn
	{
		wait 300
		attachtotag truck tag_engine
		setstate truck_blacksmoke invisible
	}
}
truck_whitesmoke
{
	spawn
	{
		wait 300
		attachtotag truck tag_exhaust
		setstate truck_whitesmoke invisible
	}
}

//misc_gamemodel
truck_body
{
	spawn
	{
		wait 50
		attachtotag truck tag_origin		// non-existing => model-origin
		setstate truck_body default
	}
	trigger damaged_model
	{
		setstate truck_body invisible
		setstate truck_body_damaged default
	}
	trigger repaired_model
	{
		setstate truck_body default
		setstate truck_body_damaged invisible
	}
}
truck_fwheels
{
	spawn
	{
		wait 300
		attachtotag truck_body tag_wfront
	}
	trigger forward
	{
		setrotation 180 0 0
	}
	trigger backward
	{
		setrotation -180 0 0
	}
	trigger stop
	{
		stoprotation
	}
}
truck_bwheels
{
	spawn
	{
		wait 300
		attachtotag truck_body tag_wback
	}
	trigger forward
	{
		setrotation 180 0 0
	}
	trigger backward
	{
		setrotation -180 0 0
	}
	trigger stop
	{
		stoprotation
	}
}

truck_body_damaged
{
	spawn
	{
		wait 400
		attachtotag truck tag_origin		// non-existing => model-origin
		setstate truck_body_damaged invisible
	}
}
truck_fwheels_damaged
{
	spawn
	{
		wait 300
		attachtotag truck_body_damaged tag_wfront
	}
}
truck_bwheels_damaged
{
	spawn
	{
		wait 300
		attachtotag truck_body_damaged tag_wback
	}
}

//script_mover
truck_exhaust
{
	spawn
	{
		wait 50
		attachtotag truck tag_origin		// non-existing => model-origin
	}
}

//===========================rode lampies ======================================================\\
RL_3
{
	spawn
	{
		wait 100
		setposition path_3
		setstate RL_3 invisible
	}
	trigger show
	{
		setstate RL_3 default
	}
}
RL_4
{
	spawn
	{
		wait 100
		setposition path_4
		setstate RL_4 invisible
	}
	trigger show
	{
		setstate RL_4 default
	}
}
RL_5
{
	spawn
	{
		wait 100
		setposition path_5
		setstate RL_5 invisible
	}
	trigger show
	{
		setstate RL_5 default
	}
}
RL_6
{
	spawn
	{
		wait 100
		setposition path_6
		setstate RL_6 invisible
	}
	trigger show
	{
		setstate RL_6 default
	}
}
RL_7
{
	spawn
	{
		wait 100
		setposition path_7
		setstate RL_7 invisible
	}
	trigger show
	{
		setstate RL_7 default
	}
}
RL_8
{
	spawn
	{
		wait 100
		setposition path_8
		setstate RL_8 invisible
	}
	trigger show
	{
		setstate RL_8 default
	}
}
RL_9
{
	spawn
	{
		wait 100
		setposition path_9
		setstate RL_9 invisible
	}
	trigger show
	{
		setstate RL_9 default
	}
}
RL_10
{
	spawn
	{
		wait 100
		setposition path_10
		setstate RL_10 invisible
	}
	trigger show
	{
		setstate RL_10 default
	}
}
RL_11
{
	spawn
	{
		wait 100
		setposition path_11
		setstate RL_11 invisible
	}
	trigger show
	{
		setstate RL_11 default
	}
}
RL_12
{
	spawn
	{
		wait 100
		setposition path_12
		setstate RL_12 invisible
	}
	trigger show
	{
		setstate RL_12 default
	}
}
RL_13
{
	spawn
	{
		wait 100
		setposition path_13
		setstate RL_13 invisible
	}
	trigger show
	{
		setstate RL_13 default
	}
}
RL_14
{
	spawn
	{
		wait 100
		setposition path_14
		setstate RL_14 invisible
	}
	trigger show
	{
		setstate RL_14 default
	}
}
RL_15
{
	spawn
	{
		wait 100
		setposition path_15
		setstate RL_15 invisible
	}
	trigger show
	{
		setstate RL_15 default
	}
}
RL_16
{
	spawn
	{
		wait 100
		setposition path_16
		setstate RL_16 invisible
	}
	trigger show
	{
		setstate RL_16 default
	}
}
RL_17
{
	spawn
	{
		wait 100
		setposition path_17
		setstate RL_17 invisible
	}
	trigger show
	{
		setstate RL_17 default
	}
}
RL_18
{
	spawn
	{
		wait 100
		setposition path_18
		setstate RL_18 invisible
	}
	trigger show
	{
		setstate RL_18 default
	}
}
RL_19
{
	spawn
	{
		wait 100
		setposition path_19
		setstate RL_19 invisible
	}
	trigger show
	{
		setstate RL_19 default
	}
}
RL_20
{
	spawn
	{
		wait 100
		setposition path_20
		setstate RL_20 invisible
	}
	trigger show
	{
		setstate RL_20 default
	}
}
RL_21
{
	spawn
	{
		wait 100
		setposition path_21
		setstate RL_21 invisible
	}
	trigger show
	{
		setstate RL_21 default
		setstate RL_21b default
	}
}
RL_21b
{
	spawn
	{
		wait 100
		setposition path_21
		setstate RL_21b invisible
	}
}
RL_22
{
	spawn
	{
		wait 100
		setposition path_22
		setstate RL_22 invisible
	}
	trigger show
	{
		setstate RL_22 default
		setstate RL_22b default
	}
}
RL_22b
{
	spawn
	{
		wait 100
		setposition path_22
		setstate RL_22b invisible
	}
}

//===============================================================================================\\
//accum 0: 0=kapot, 1=gemaakt
//accum 1: 0=truck niet voorbij, 1=truck wel voorbij

truck_barrier
{
	// Deze entity komt in de map
	spawn
	{
		accum 0 set 0
		accum 1 set 0
		accum 2 set 0
		wait 150

		trigger truck_barrier showcrates

		constructible_class 3
		constructible_weaponclass 3
		constructible_chargebarreq 1.5
		//constructible_health 350
		constructible_duration 3000
		constructible_constructxpbonus 20
		constructible_destructxpbonus 20
	}

	// kisten+vlag
	trigger showcrates
	{
		accum 1 abort_if_equal 1
		
		setstate truck_bar_mat default
		setstate truck_bar_mat_clip default
		setstate truck_bar_flag default

		setstate truck_bar_hurt invisible
		setstate truck_bar_teeth1 invisible
		setstate truck_bar_teeth2 invisible

		trigger truck barrier_unbuild

		trigger truck_barrier nosound

		accum 2 abort_if_equal 0


	}
	trigger nosound
	{
		accum 2 abort_if_equal 1
		accum 2 set 1
	}
	trigger hidecrates
	{
		setstate truck_bar_mat invisible
		setstate truck_bar_mat_clip invisible
		setstate truck_bar_flag invisible

		setstate truck_bar_hurt default
		setstate truck_bar_teeth1 default
		setstate truck_bar_teeth2 default

		accum 1 abort_if_equal 1

		trigger truck barrier_build	
	}
	trigger truck_past
	{
		accum 1 set 1	//truck is voorbij de barrier

		setstate truck_bar_mat invisible
		setstate truck_bar_mat_clip invisible
		setstate truck_bar_flag invisible
		setstate truck_bar_toi invisible

	}


	buildstart final
	{

		trigger self showcrates
		setstate truck_bar_teeth1 underconstruction
		setstate truck_bar_teeth2 underconstruction
	}
	built final
	{
		wm_announce "^3 The Allies have build the truck barrier!!!"
		trigger self hidecrates

	}

	decayed final
	{
		trigger self showcrates
	}
	death
	{
		wm_announce "^3 The Axis have destroyed the barrier!!!"
		trigger self showcrates

	}
}
//================<>============================================================<>================\\
//allies Command Post

allies_cp_built
{
	spawn
	{
		wait 400
		setstate allies_cp_damaged_model invisible
		constructible_class 2
		constructible_constructxpbonus 10
		constructible_destructxpbonus 10
	}

	buildstart final
	{
		setstate allies_cp_built_model underconstruction
		setstate allies_cp_closed_clip invisible
		setstate allies_cp_closed_model invisible
		setstate allies_cp_damaged_model invisible
	}

	built final
	{
		setstate allies_cp_built_model default
		setstate allies_cp_closed_clip invisible
		setstate allies_cp_closed_model invisible
		setstate allies_cp_damaged_model invisible
		trigger allies_cp_built_model build

		wm_announce "^4Allies Command Post constructed, Allied spawntime decreased."

		playsound sound/world/radio_axis.wav looping volume 256

	}

	decayed final
	{
		setstate allies_cp_built_model invisible
		setstate allies_cp_closed_clip default
		setstate allies_cp_closed_model default
		setstate allies_cp_damaged_model invisible
	}

	death
	{
		setstate allies_cp_built_model invisible
		setstate allies_cp_closed_clip default
		setstate allies_cp_closed_model invisible
		setstate allies_cp_damaged_model default
		trigger allies_cp_built_model deadth

		wm_announce "^1Allies Command Post destroyed, Allied spawntime increased."

		stopsound
	}
}

allies_cp_built_model
{
	spawn
	{
		wait 50
		setstate allies_cp_built_model invisible
	}
	trigger build
	{
		setchargetimefactor 1 soldier 0.75
		setchargetimefactor 1 lieutenant 0.75
		setchargetimefactor 1 medic 0.75
		setchargetimefactor 1 engineer 0.75
		setchargetimefactor 1 covertops 0.75

		wm_axis_respawntime 10
		wm_allied_respawntime 10

		wm_objective_status 6 1 1	
	}
	trigger deadth
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1

		wm_axis_respawntime 7
		wm_allied_respawntime 15

		wm_objective_status 6 1 0
	}
}
//================<>=============================================================================\\
// de axis CP
axis_cp_built
{
	spawn
	{
		wait 400
		setstate axis_cp_damaged_model invisible
		constructible_class 2
		constructible_constructxpbonus 10
		constructible_destructxpbonus 10
	}

	buildstart final
	{
		setstate axis_cp_built_model underconstruction
		setstate axis_cp_closed_clip invisible
		setstate axis_cp_closed_model invisible
		setstate axis_cp_damaged_model invisible
	}

	built final
	{
		setstate axis_cp_built_model default
		setstate axis_cp_closed_clip invisible
		setstate axis_cp_closed_model invisible
		setstate axis_cp_damaged_model invisible
		trigger axis_cp_built_model build

		wm_announce "^1Axis CP constructed, Axis spawntime decreased."
		wm_teamvoiceannounce 0 sound/UJE_vulcano_escape/CP/made.wav
		wm_teamvoiceannounce 1 sound/UJE_vulcano_escape/CP/made.wav

		playsound sound/world/radio_allies.wav looping volume 256
	}

	decayed final
	{
		setstate axis_cp_damaged_model invisible
		setstate axis_cp_built_model invisible
		setstate axis_cp_closed_clip default
		setstate axis_cp_closed_model default
	}

	death
	{
		setstate axis_cp_built_model invisible
		setstate axis_cp_closed_model invisible
		setstate axis_cp_closed_clip default
		setstate axis_cp_damaged_model default
		trigger axis_cp_built_model death

		wm_announce "^4Axis CP destroyed."
		wm_teamvoiceannounce 0 sound/UJE_vulcano_escape/CP/deadth.wav
		wm_teamvoiceannounce 1 sound/UJE_vulcano_escape/CP/deadth.wav

		stopsound
	}
}

axis_cp_built_model
{
	spawn
	{
		wait 50
		setstate axis_cp_built_model invisible
	}
	trigger build
	{
		setchargetimefactor 1 soldier 0.75
		setchargetimefactor 1 lieutenant 0.75
		setchargetimefactor 1 medic 0.75
		setchargetimefactor 1 engineer 0.75
		setchargetimefactor 1 covertops 0.75

		wm_axis_respawntime 7
		wm_allied_respawntime 15

		wm_objective_status 6 0 1	
	}
	trigger deadth
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1

		wm_axis_respawntime 10
		wm_allied_respawntime 10

		wm_objective_status 6 0 0
	}
}
//===============================================================================================\\
//=========================================SOUNDS================================================\\
//================<>=============================================================================\\
//================<>=============================================================================\\
